package com.dongway.netcondition.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.dongway.core.common.Paginator;
import com.dongway.core.web.AbstractBaseController;
import com.dongway.netcondition.model.DevRecord;
import com.dongway.netcondition.model.OperationRecord;
import com.dongway.netcondition.service.DevRecordService;
import com.dongway.netcondition.service.OperationRecordService;

@Controller
public class RecordController extends AbstractBaseController {

    @Autowired
    private DevRecordService devRecordService;
    @Autowired
    private OperationRecordService operationRecordService;


    @RequestMapping("/record1.htm")
    public String record1(ModelMap modelMap, Paginator paginator) {
        List<OperationRecord> records = operationRecordService.all(paginator);
        modelMap.put("records", records);
        modelMap.put("paginator", paginator);
        return "net/record1";
    }


    @RequestMapping("/record2.htm")
    public String record2(ModelMap modelMap,  Paginator paginator) {
        List<DevRecord> records = devRecordService.all(paginator);
        modelMap.put("records", records);
        modelMap.put("paginator", paginator);       
        return "net/record2";
    }
    @RequestMapping("/queryRecord.htm")
    public String recordQuery(ModelMap modelMap,String startTime,String endTime,Paginator paginator){
    	 List<DevRecord> records = devRecordService.queryBytime(startTime,endTime,paginator);
    	System.out.println("开始时间："+startTime);
    	System.out.println("结束时间："+endTime);
    	System.out.println("size:"+records.size());
    	 modelMap.put("records", records);
         modelMap.put("paginator", paginator); 
         System.out.println("size:"+records.size());
    	 return "net/record2";
    	
    	
    }
    
    
}
